<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<title><s:text name="jsp.user.login.title" />
		</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="description" content="<s:text name="jsp.user.login.title" />">
		<script type="text/javascript">
			function login(){
					var userName=document.getElementById('login_userName').value.replace(/^\s+|\s+$/g,"");
					var password=document.getElementById('login_password').value.replace(/^\s+|\s+$/g,"");
					var login_userName_error=document.getElementById('login_userName_error');
					var login_password_error=document.getElementById('login_password_error');
					if(userName==''){
						document.getElementById('login_userName').value='';
						login_userName_error.innerText='[<s:text name="validation.user.login.username.null" />]';
						}
					else{
						login_userName_error.innerText='';
						}
					if(password==''){
						document.getElementById('login_password').value='';
						login_password_error.innerText='[<s:text name="validation.user.login.password.null" />]';
						}
					else{
						login_password_error.innerText='';
						}
					if(userName!=''&&password!=''){
						document.loginForm.submit();
						}
				}
			function loginreset(){
				document.getElementById('login_userName_error').innerText='';
				document.getElementById('login_password_error').innerText='';
				}
		</script>
	</head>
	<body>
		<jsp:include page="/system/language" />
		<form action="user/userLogin" method="post" name="loginForm">
			<table class="wwFormTable">
				<tr>
					<td class="tdLabel">
						<label for="login_userName" class="label">
							<s:text name="jsp.user.login.label.username" />
						</label>
					</td>
					<td>
						<input type="text" name="userName" value="${userName }"
							id="login_userName" />
					</td>
					<td>
						<div id="login_userName_error" class="error_label" style="color: red;">
							<s:property value="errors.userName" />
						</div>
					</td>
				</tr>
				<tr>
					<td class="tdLabel">
						<label for="login_password" class="label">
							<s:text name="jsp.user.login.label.password" />
						</label>
					</td>
					<td>
						<input type="password" name="password" id="login_password" />
					</td>
					<td>
						<div id="login_password_error" class="error_label" style="color: red;">
							<s:property value="errors.password" />
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<div align="center">
							<input type="button" onclick="login()"
								value="<s:text name="jsp.user.login.button.submit"/>" />
							<input type="reset" onclick="loginreset()"
								value="<s:text name="jsp.user.login.button.reset"/>"  />
						</div>
					</td>
				</tr>
			</table>
		</form>
		<s:debug></s:debug>
	</body>
</html>
